package thread;

import java.util.Scanner;

public class demo19 {
 static class Count{
     public static  int flag=0;
 }
    public static void main(String[] args) {
     Count count=new Count();
     Thread t1=new Thread(()->{
            while (count.flag==0){
                //do noting
            }
         System.out.println("循环结束");
        });
     Thread t2=new Thread(()->{
         Scanner scanner=new Scanner(System.in);
         System.out.println("请输入值来改变flag");
         count.flag=scanner.nextInt();
     });
        t1.start();
        t2.start();

    }
}
